import router from "@/router";
import {Message} from '@arco-design/web-vue';

class LocationConf {
    title;
    name;


    constructor(title, name) {
        this.title = title;
        this.name = name;
    }
}

class MobileLocation extends LocationConf {

    manPanel;

    rightMenu;

    leftArrow;

    isDevPanel;


    constructor({title, name, manPanel = false, rightMenu = false, leftArrow = true, isDevPanel = false}) {
        super(title, name)
        this.title = title;
        this.name = name;
        this.manPanel = manPanel;
        this.rightMenu = rightMenu
        this.leftArrow = leftArrow;
        this.isDevPanel = isDevPanel
    }
}

export default {
    switchPageTo: (page, param) => {
        let routerName = page.name;
        let currentLocation = router.currentRoute.value;
        if (currentLocation.name === routerName) {
            return;
        }
        router.push({name: page.name, state: param});
        if (process.env.NODE_ENV === 'development') {
            Message.info({content: `You select  ${routerName}`, showIcon: true});
        }
    },
    camera: new LocationConf('摄像头', 'camera'),
    default_area: new LocationConf('默认区域', 'default_area'),
    dev_account: new LocationConf('设备账户管理', 'dev_account'),
    user: new LocationConf('用户管理', 'user'),
    pc_settings: new LocationConf('系统参数设置', 'pc_settings'),
    // 移动端路径
    m: {
        homepage: '/m/login',
        login: new MobileLocation({
            title: '登录', name: 'login', rightMenu: false, leftArrow: false
        }),
        quadruped: new MobileLocation({
            title: '四足机器人', name: 'quadruped', isDevPanel: true
        }),
        CamQuadruped: new MobileLocation({
            title: '视频四足机器人', name: 'CamQuadruped', isDevPanel: true, rightMenu: true
        }),
        Camera: new MobileLocation({
            title: '摄像头', name: 'Camera', rightMenu: true, isDevPanel: true
        }),
        camCar: new MobileLocation({
            title: '视频小车', name: 'camCar', rightMenu: true,
            isDevPanel: true
        }), ServoSwitch: new MobileLocation({
            title: '舵机开关', name: 'ServoSwitch',
            isDevPanel: true
        }),
        dev_list: new MobileLocation({
            title: '设备列表', name: 'dev_list', manPanel: true, leftArrow: false, isDevPanel: false
        }), settings: new MobileLocation({
            title: '设置', name: 'settings', manPanel: true, leftArrow: false, isDevPanel: false
        })
    }


}
